﻿function GoogleLanguageInitializeLiteral(client_id, dest_lang) 
{
    var text = document.getElementById(client_id).innerHTML;
    google.language.detect(text, function(result) {
        if (!result.error && result.language) {
            google.language.translate(text, result.language, dest_lang,
                function(result) {
                    if (!result.error) {
                        var translated = document.getElementById(client_id);
                        if (result.translation) {
                            translated.innerHTML = result.translation;
                        }
                    }
                });
        }
    });
}
